Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Make flakey test more permissive #1212

Merged
merged 1 commit into from Oct 2, 2019

Conversation

lithp
Copy link
Contributor

@lithp lithp commented Oct 2, 2019

What was wrong?

tests/p2p/test_token_bucket.py::test_token_bucket_initial_tokens was a little flakey, I ran it 10k times (while compiling rust to simulate a bursty load on the CI box) and it failed 8 times. As a quick solution I've made the test more permissive and it hasn't failed on me again.

A better solution might be to change the test. I think it's making sure that we never sleep when pulling tokens from a full bucket, maybe this test could mock out the time api, and then check that sleep() is never called.

Cute Animal Picture

dog-play-snow

@lithp
Copy link
Contributor Author

lithp commented Oct 2, 2019

Hmm, even with this change it fails:

Selection_031

@lithp
Copy link
Contributor Author

lithp commented Oct 2, 2019

TokenBucket eventually has to make the migration to trio, so maybe asyncio.sleep() could be injected through the constructor. This would make testing it much easier, especially under trio: https://trio.readthedocs.io/en/stable/reference-testing.html#time-and-timeouts

@lithp
Copy link
Contributor Author

lithp commented Oct 2, 2019

Example test failure: https://circleci.com/gh/ethereum/trinity/129012

@lithp
Copy link
Contributor Author

lithp commented Oct 2, 2019

A test flaked on a PR meant to fix a different flaking test 🙄

Opened a ticket: #1213

@lithp lithp merged commit 3254122 into ethereum:master Oct 2, 2019
@lithp lithp deleted the lithp/token-bucket-flake branch October 2, 2019 22:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants